"""
@file:   app.py.py
@author: Shuai
@date:   2020/04/29
"""
import os
from flask import Flask
from flask_cors import CORS
from celery import Celery


def create_app(config=None):
    # 创建核心对象
    app = Flask(__name__)
    CORS(app, supports_credentials=True)
    # 加载配置文件
    app.config.from_pyfile("config/conf.py")
    app.config.from_pyfile("config/secure.py")
    # 注册路由、数据库
    import router
    router.init_app(app)
    import models
    models.init_app(app)
    return app
